Skip to content

fix: preserve commit error handling through describe/exec/describe#309

Open
hjotha wants to merge 2 commits intomendixlabs:mainfrom
hjotha:audit/writer-commit-onerror-default
Open

fix: preserve commit error handling through describe/exec/describe#309
hjotha wants to merge 2 commits intomendixlabs:mainfrom
hjotha:audit/writer-commit-onerror-default

Conversation

@hjotha
Copy link
Copy Markdown
Contributor

@hjotha hjotha commented Apr 26, 2026

Part of #332.

Fixes #308.

Summary

commit $X on error rollback; could roundtrip as plain commit $X; after rewriting an MPR.

Root cause

The commit writer omitted ErrorHandlingType when it was rollback, treating it as implicit. The parser then left absent ErrorHandlingType empty, so the describer had no rollback setting to print on the next describe.

Fix

Make commit parser/writer behavior symmetric:

  • Parser defaults absent commit ErrorHandlingType to rollback.
  • Writer always emits commit ErrorHandlingType, defaulting to rollback.

Tests

Added parser/writer regression coverage for commit rollback preservation.

Validation

  • make build
  • make test
  • make lint-go
  • make test-integration

Agentic Code Testing

  • No new authoring syntax.
  • Synthetic parser/writer coverage verifies the roundtrip behavior agents rely on.

Test plan

  • Commit rollback survives BSON parse/write.
  • Existing action writer behavior remains covered by the full test suite.

`commit $X on error rollback;` could roundtrip as plain `commit $X;` after rewriting an MPR.

The writer omitted `ErrorHandlingType` when it equaled rollback, treating it as implicit. The parser then defaulted an absent field to an empty value, so the next describe had no rollback setting to print.

Make parser and writer behavior symmetric: default absent commit `ErrorHandlingType` to rollback while parsing, and always write commit `ErrorHandlingType`, defaulting to rollback.

Tests cover parser and writer preservation for commit rollback handling.
@github-actions
Copy link
Copy Markdown

AI Code Review

Review Summary

Critical Issues

None found.

Moderate Issues

None found.

Minor Issues

None found.

What Looks Good

  • Bug fix correctness: The changes symmetrically handle ErrorHandlingType in commit actions - parser now defaults absent values to rollback, and writer always emits the field (defaulting to rollback). This resolves the roundtrip issue where commit $X on error rollback; would become plain commit $X; after rewrite.
  • Test coverage: Added two focused unit tests in parser_microflow_test.go covering both explicit ErrorHandlingType and default rollback behavior. These directly validate the fix.
  • Minimal, scoped changes: Only touches the necessary parser/writer logic for commit actions without side effects. No unrelated modifications.
  • Validation passed: All local validation steps (make build, make test, make lint-go, make test-integration) succeeded per the PR.
  • No syntax changes: Since this is a pure BSON serialization fix (no MDL grammar/AST/visitor/executor changes), the full-stack consistency and MDL syntax design checklists don't apply - appropriately skipped.

Recommendation

Approve. The fix correctly addresses the root cause with appropriate test coverage and maintains backward compatibility. The changes are minimal, well-scoped, and follow the project's patterns for BSON handling. No further action needed.


Automated review via OpenRouter (Nemotron Super 120B) — workflow source

Adds an MDL script under mdl-examples/bug-tests/ that exercises
describe → exec → describe fixpoint for `commit $X on error rollback;`,
plus a negative control using `on error continue;`.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

AI Code Review

Critical Issues

None found.

Moderate Issues

None found.

Minor Issues

None found.

What Looks Good

  • The PR correctly identifies and fixes the root cause of the commit error handling roundtrip issue (BUG Commit error handling can be dropped during MPR rewrite #308).
  • Changes are minimal and focused: parser and writer adjustments for CommitObjectsAction.ErrorHandlingType to ensure symmetry.
  • Tests are comprehensive:
    • New bug test in mdl-examples/bug-tests/ validates the fix.
    • Unit tests in sdk/mpr/parser_microflow_test.go cover explicit and default cases.
    • Existing test suite passes (as noted in validation).
  • The fix maintains backward compatibility and follows the project's BSON handling patterns.
  • No MDL syntax changes were made, so syntax design and full-stack consistency checks are not applicable.
  • The PR adheres to scope and atomicity principles (single bug fix).
  • No security or robustness concerns introduced.

Recommendation

Approve the PR. The changes are correct, well-tested, and address the specific issue without introducing side effects. The fix ensures commit error handling (rollback/continue) persists through describe/exec/describe cycles as required.


Automated review via OpenRouter (Nemotron Super 120B) — workflow source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Commit error handling can be dropped during MPR rewrite

2 participants